<template>
  <div class="page-my-order">
    <!-- 导航栏 -->
    <van-nav-bar title="我的订单" left-text="返回" left-arrow @click-left="goBack" />
    <!-- 标签栏 -->
    <van-tabs v-model:active="activeTab">
      <van-tab :title="value" :name="key" v-for="(value, key, index) in ORDER_STATUS" :key="index"
        ><OrderList :orderType="key"
      /></van-tab>
      <!-- <van-tab title="全部" name="0"><OrderList orderType="all" /></van-tab>
      <van-tab title="待支付" name="1"><OrderList orderType="wait" /></van-tab>
      <van-tab title="已完成" name="2"><OrderList orderType="finish" /></van-tab>
      <van-tab title="已取消" name="3"><OrderList orderType="canceled" /></van-tab> -->
    </van-tabs>
  </div>
</template>

<script>
import OrderList from '@/components/order/OrderList.vue'
import { ORDER_STATUS } from '@/utils/constants'
export default {
  data() {
    return {
      activeTab: 1
    }
  },
  methods: {
    // 返回到我的页面
    goBack() {
      this.$router.push({ name: 'minePage' })
    },
    change() {
      this.activeTab = 0
    }
  },
  created() {
    // 获取订单类型
    this.activeTab = this.$route.params.tabId

    // 拿到常量值
    this.ORDER_STATUS = ORDER_STATUS
  },
  components: {
    OrderList
  }
}
</script>